package com.chan.net;

public class Result<T> {
    int code;
    String message;
    T data;

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }


    /**
     * 请求网络失败原因
     */
    public static class FAILCODE {
        /**
         * 解析数据失败
         */
        public static final int CODE_PARSE_ERROR = 0x10000;
        /**
         * 网络问题
         */
        public static final int CODE_BAD_NETWORK = 0x10001;

        /**
         * 连接错误
         */
        public static final int CODE_CONNECT_ERROR = 0x10002;

        /**
         * 连接超时
         */
        public static final int CODE_CONNECT_TIMEOUT = 0x10003;

        /**
         * 未知错误
         */
        public static final int CODE_UNKNOWN_ERROR = 0x10004;

        /**
         * data为null
         */
        public static final int CODE_DATA_EMPTY = 0x10005;
    }
}
